#include <QObject>
#include <QString>
#include <QVector>
#include <QUrl>

class LocalDirIterator:public QObject {
    Q_OBJECT
    Q_PROPERTY(QUrl currentFilename READ currentFilename NOTIFY currentFilenameChanged)
    Q_PROPERTY(QString currentFolder READ currentFolder NOTIFY currentFolderChanged)
    Q_PROPERTY(bool empty READ empty NOTIFY emptyChanged)
public:
    LocalDirIterator(QObject *parent = nullptr, const QString& path= "");
    bool empty() const;
    QUrl currentFilename() const;

    // current Folder
    QString currentFolder() const;

    Q_INVOKABLE void nextImage();
    Q_INVOKABLE void previousImage();

signals:
    void emptyChanged();
    bool currentFilenameChanged();
    bool currentFolderChanged();

public slots:
    void onPreviousClicked();
    
    void onNextClicked();

    // change folder
    bool onChangeFolder(QString path);

private:
    QVector<QString> imageList;
    QString m_FolderPath; // folder
    int position;
    static bool isImageFile(const QString&);
};
